package cn.dyw.cloudmusic.dao;

import cn.dyw.cloudmusic.entity.MusicComment;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.ResultMap;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

@Mapper
public interface MusicCommentMapper {
    /**
     */
    @Delete({
        "delete from music_comment",
        "where id = #{id,jdbcType=VARCHAR}"
    })
    int deleteByPrimaryKey(String id);

    /**
     */
    @Insert({
        "insert into music_comment (id, is_musician, ",
        "user_id, code, total)",
        "values (#{id,jdbcType=VARCHAR}, #{isMusician,jdbcType=BIT}, ",
        "#{userId,jdbcType=INTEGER}, #{code,jdbcType=INTEGER}, #{total,jdbcType=INTEGER})"
    })
    int insert(MusicComment record);

    /**
     */
    int insertSelective(MusicComment record);

    /**
     */
    @Select({
        "select",
        "id, is_musician, user_id, code, total",
        "from music_comment",
        "where id = #{id,jdbcType=VARCHAR}"
    })
    @ResultMap("cn.dyw.cloudmusic.dao.MusicCommentMapper.BaseResultMap")
    MusicComment selectByPrimaryKey(String id);

    /**
     */
    int updateByPrimaryKeySelective(MusicComment record);

    /**
     */
    @Update({
        "update music_comment",
        "set is_musician = #{isMusician,jdbcType=BIT},",
          "user_id = #{userId,jdbcType=INTEGER},",
          "code = #{code,jdbcType=INTEGER},",
          "total = #{total,jdbcType=INTEGER}",
        "where id = #{id,jdbcType=VARCHAR}"
    })
    int updateByPrimaryKey(MusicComment record);
}